home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 4.1 KB | 161 lines | [TEXT/MPS ] |
- // The C++ Booch Components (Version 2.1)
- // (C) Copyright 1990-1993 Grady Booch. All Rights Reserved.
- //
- // Restricted Rights Legend
- // Use, duplication, or disclosure is subject to restrictions as set forth
- // in subdivision (c)(1)(ii) of the Rights in Technical Data and Computer
- // Software clause at DFARS 252.227-7013.
- //
- // BCStacD.cpp
- //
- // This file contains the definitions for the bounded stack.
-
- #include "BCStacD.h"
-
- template<class Item, class StorageManager>
- BC_TDynamicStack<Item, StorageManager>::BC_TDynamicStack() {}
-
- template<class Item, class StorageManager>
- BC_TDynamicStack<Item, StorageManager>::BC_TDynamicStack(BC_Index chunkSize)
- : fRep(chunkSize) {}
-
- template<class Item, class StorageManager>
- BC_TDynamicStack<Item, StorageManager>::
- BC_TDynamicStack(const BC_TDynamicStack<Item, StorageManager>& s)
- : fRep(s.fRep) {}
-
- template<class Item, class StorageManager>
- BC_TDynamicStack<Item, StorageManager>::~BC_TDynamicStack() {}
-
- template<class Item, class StorageManager>
- BC_TStack<Item>& BC_TDynamicStack<Item, StorageManager>::
- operator=(const BC_TStack<Item>& s)
- {
- return BC_TStack<Item>::operator=(s);
- }
-
- template<class Item, class StorageManager>
- BC_TStack<Item>& BC_TDynamicStack<Item, StorageManager>::
- operator=(const BC_TDynamicStack<Item, StorageManager>& s)
- {
- fRep = s.fRep;
- return *this;
- }
-
- template<class Item, class StorageManager>
- BC_Boolean BC_TDynamicStack<Item, StorageManager>::
- operator==(const BC_TStack<Item>& s) const
- {
- return BC_TStack<Item>::operator==(s);
- }
-
- template<class Item, class StorageManager>
- BC_Boolean BC_TDynamicStack<Item, StorageManager>::
- operator==(const BC_TDynamicStack<Item, StorageManager>& s) const
- {
- return (fRep == s.fRep);
- }
-
- template<class Item, class StorageManager>
- BC_Boolean BC_TDynamicStack<Item, StorageManager>::
- operator!=(const BC_TDynamicStack<Item, StorageManager>& s) const
- {
- return !operator==(s);
- }
-
- template<class Item, class StorageManager>
- void BC_TDynamicStack<Item, StorageManager>::SetChunkSize(BC_Index ChunkSize)
- {
- fRep.SetChunkSize(ChunkSize);
- }
-
- template<class Item, class StorageManager>
- void BC_TDynamicStack<Item, StorageManager>::Preallocate(BC_Index new_length)
- {
- fRep.Preallocate(new_length);
- }
-
- template<class Item, class StorageManager>
- void BC_TDynamicStack<Item, StorageManager>::Clear()
- {
- fRep.Clear();
- }
-
- template<class Item, class StorageManager>
- void BC_TDynamicStack<Item, StorageManager>::Push(const Item& item)
- {
- fRep.Insert(item);
- }
-
- template<class Item, class StorageManager>
- void BC_TDynamicStack<Item, StorageManager>::Pop()
- {
- fRep.Remove(0);
- }
-
- template<class Item, class StorageManager>
- BC_Index BC_TDynamicStack<Item, StorageManager>::ChunkSize() const
- {
- return fRep.ChunkSize();
- }
-
- template<class Item, class StorageManager>
- BC_Index BC_TDynamicStack<Item, StorageManager>::Depth() const
- {
- return fRep.Length();
- }
-
- template<class Item, class StorageManager>
- BC_Boolean BC_TDynamicStack<Item, StorageManager>::IsEmpty() const
- {
- return (fRep.Length() == 0);
- }
-
- template<class Item, class StorageManager>
- const Item& BC_TDynamicStack<Item, StorageManager>::Top() const
- {
- return fRep.First();
- }
-
- template<class Item, class StorageManager>
- Item& BC_TDynamicStack<Item, StorageManager>::Top()
- {
- return fRep.First();
- }
-
- template<class Item, class StorageManager>
- void* BC_TDynamicStack<Item, StorageManager>::operator new(size_t s)
- {
- return StorageManager::Allocate(s);
- }
-
- template<class Item, class StorageManager>
- void BC_TDynamicStack<Item, StorageManager>::operator delete(void* p, size_t s)
- {
- StorageManager::Deallocate(p, s);
- }
-
- template<class Item, class StorageManager>
- void BC_TDynamicStack<Item, StorageManager>::Purge()
- {
- fRep.Clear();
- }
-
- template<class Item, class StorageManager>
- void BC_TDynamicStack<Item, StorageManager>::Add(const Item& item)
- {
- fRep.Append(item);
- }
-
- template<class Item, class StorageManager>
- BC_Index BC_TDynamicStack<Item, StorageManager>::Cardinality() const
- {
- return fRep.Length();
- }
-
- template<class Item, class StorageManager>
- const Item& BC_TDynamicStack<Item, StorageManager>::ItemAt(BC_Index index) const
- {
- return fRep.ItemAt(index);
- }
-